package sctu.edu.java.year2016.team07.wenjia.day20160602.Chapter10_1;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

/**
 * Created by 001 on 2016/6/2.
 * 将1~100之间的所有正整数存放在一个list集合中
 * 并将集合中索引位置是10的对象从集合中移除
 */
public class Remove {
    public static void main(String[] args) {

        List<Integer> list=new LinkedList<>();

        for(int i=1;i<=100;i++)

            list.add(i);

        Iterator<Integer> num=list.iterator();

        System.out.println("移除前的集合是：");

        while(num.hasNext()){

            System.out.print(num.next()+" ");
        }

        list.remove(10);

        Iterator<Integer> num1=list.iterator();

        System.out.println();

        System.out.println("移除后的集合是：");

        while(num1.hasNext()){

            System.out.print(num1.next()+" ");
        }
    }
}
